﻿<sdk:Page x:Class="SampleBrowser.Views.SampleThumbnails" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
           xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
           xmlns:doc="http://schemas.firstfloorsoftware.com/documenttoolkit"
           xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
           xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="Page Thumbnails">
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <TextBlock x:Name="HeaderText" Style="{StaticResource HeaderTextStyle}" 
                           Text="Page Thumbnails"/>

        <doc:DocumentDataSource x:Name="DataSource" DefaultThumbnailMaxSize="192,192" />

        <!-- horizontal thumbnail list -->
        <doc:ThumbnailListBox Grid.Row="1" DocumentDataSource="{Binding ElementName=DataSource}">
            <doc:ThumbnailListBox.Template>
                <ControlTemplate TargetType="doc:ThumbnailListBox">
                    <ListBox x:Name="ListBox"
                             ItemsSource="{Binding DocumentDataSource.DefaultThumbnailCollection, RelativeSource={RelativeSource TemplatedParent}}"
                             ItemTemplate="{StaticResource ThumbnailTemplate}">
                        <i:Interaction.Behaviors>
                            <doc:PageVirtualizer />
                        </i:Interaction.Behaviors>
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Horizontal" />
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                    </ListBox>
                </ControlTemplate>
            </doc:ThumbnailListBox.Template>
        </doc:ThumbnailListBox>
    </Grid>
</sdk:Page>
